#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ._base import CrmConfig, AdminConfig, ApiConfig


all = ['DevCrmConfig', 'DevAdminConfig', 'DevApiConfig']


class DevMixin(object):
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://big_data:Linlong219@rm-bp193z0m7lmk92b81.mysql.rds.aliyuncs.com:3306/fan_xian_dev?charset=utf8mb4"
    SQLALCHEMY_BINDS = {
        'fx': "mysql+pymysql://big_data:Linlong219@rm-bp193z0m7lmk92b81.mysql.rds.aliyuncs.com:3306/fan_xian_dev?charset=utf8mb4",
    }
    RUN_ENV = 'dev'
    DEBUG = False
    PROPAGATE_EXCEPTIONS = True
    MOBILE_ENABLE = True

    # redis
    REDIS_DB = 0
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # REDIS_PASSWORD = 'fx_redis$%^'

    IMAGES_DOMAIN = 'http://47.104.138.224:8089/'
    UPLOAD_FOLDER = "/data/images/fx/"

    # celery 配置
    CELERY_BROKER_URL = 'redis://localhost:6379'


class DevCrmConfig(DevMixin, CrmConfig):
    WEB_HOST = 'http://www.sglalaw.com/'

    def __init__(self):
        self.LOGGERS['fx']['level'] = 'INFO'
        self.LOGGERS['fx']['file'] = '/data/log/fx/dev/crm.log'


class DevAdminConfig(DevMixin, AdminConfig):
    WEB_HOST = 'http://admin.sglalaw.com/'

    def __init__(self):
        self.LOGGERS['fx']['level'] = 'INFO'
        self.LOGGERS['fx'][
            'file'] = '/data/log/fx/dev/admin.log'


class DevApiConfig(DevMixin, ApiConfig):
    WEB_HOST = ''

    def __init__(self):
        self.LOGGERS['fx']['level'] = 'INFO'
        self.LOGGERS['fx'][
            'file'] = '/data/log/fx/dev/api.log'
